001 /*
002 * Copyright 2005 Niclas Hedhman.
003 * Copyright 2005 Stephen McConnell
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
014 * implied.
015 *
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020 package net.dpml.transit;
021
022
023 /**
024 * Exception thrown when the argument to a method or constructor is
025 * <i>null</i> and not handled by the method/constructor/class.
026 *
027 * The argument in the only constructor of this exception should only
028 * take the name of the declared argument that is null, for instance;
029 * <code><pre>
030 * public Person( String name, int age )
031 * {
032 * if( name == null )
033 * throw new NullArgumentException( "name" );
034 * if( age > 120 )
035 * throw new IllegalArgumentException( "age > 120" );
036 * if( age < 0 )
037 * throw new IllegalArgumentException( "age < 0" );
038 * }
039 * </pre></code>
040 *
041 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
042 * @version 1.0.1
043 */
044 public class NullArgumentException extends IllegalArgumentException
045 {
046 /**
047 * Serial version identifier.
048 */
049 static final long serialVersionUID = 1L;
050
051 /** Constructor taking the name of the argument that was null.
052 * @param argumentName the source code name of the argument that caused
053 * this exception.
054 */
055 public NullArgumentException( String argumentName )
056 {
057 super( argumentName );
058 }
059 }